package com.wantong.jianpu.viewmodels;

import android.app.Application;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;

import com.wantong.jianpu.activitys.DeviceConfirmActivity;
import com.wantong.jianpu.activitys.DeviceListActivity;
import com.wantong.jianpu.activitys.FaultRepairActivity;

import java.util.Date;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent;
import me.goldze.mvvmhabit.utils.DateUtil;
import me.goldze.mvvmhabit.utils.Utils;

/**
 * @author PACY
 * @date 2022/4/1
 * description:
 */
public class HomeViewModel extends BaseViewModel {
    public SingleLiveEvent<String> date=new SingleLiveEvent<>();
    public SingleLiveEvent<String> week=new SingleLiveEvent<>();
    public HomeViewModel(@NonNull Application application) {
        super(application);
    }

    @Override
    protected void init() {
        super.init();
        date.setValue(DateUtil.getNowDate(DateUtil.DatePattern.ONLY_DAY));
        week.setValue(DateUtil.getWeekOfDate(DateUtil.stringToDate(date.getValue(), DateUtil.DatePattern.ONLY_DAY)));
    }

    /**
     * 故障报修
     */
    public BindingCommand toFaultPage=new BindingCommand(() -> {
      startActivity(FaultRepairActivity.class);
    });

    /**
     * 设备巡检
     */
    public BindingCommand toDevicePage=new BindingCommand(() -> {
        startActivity(DeviceListActivity.class);
    });

    /**
     * 巡检确认
     */
    public BindingCommand toConfirmPage=new BindingCommand(() -> {
        startActivity(DeviceConfirmActivity.class);
    });


}
